<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs2.jsp"%>
<%@ page import="org.springside.core.Constants,cn.firstsoft.firstframe.admin.PropertyFile"%>
<%@ page import="cn.firstsoft.firstframe.util.AuthUtils"%>
<fmt:message key="integrat_sys_label1" var="integrat_sys_label1" />
<fmt:message key="common_setting" var="common_setting" />
<fmt:message key="portal_header_top_label14" var="portal_header_top_label14" />
<fmt:message key="portal_header_top_label1" var="portal_header_top_label1" />

<%
			String topHeight = PropertyFile.readValue("firstframe.properties", "setting.top.height"); 
			if(topHeight == null){
				topHeight = Constants.DEFAULT_TOP_HEIGHT; 
			}
			if(Constants.EAS.equalsIgnoreCase("true") && Constants.INTEGRATION_STYLE_EAS.equals("2") && (session.getAttribute("loginFrom") == null || !session.getAttribute("loginFrom").equals("oa"))){
				topHeight = "25";
			}
		%>

<%
	pageContext.setAttribute("SEPARATION_OF_POWERS",Constants.SEPARATION_OF_POWERS);
%>

<%
	boolean canSetting = AuthUtils.isAuthorized("AUTH_MODULES_SETTING");
%>

<style type="text/css">
#header_table {
 /*-moz-user-select:none;*/
 /*hutia:expression(this.onselectstart=function(){return(false)});*/
}
#headerList {
	float: left;
	overflow: hidden;
	height: 47px;
	position: absolute;
	width: 20000em;
	clear: both;
}

#headerList div {
	height: 30px;
	cursor: pointer;
	float: left;
}

a {
	blr: expression(this . onFocus = this . blur() );
}

#header_tab {
	width: 728px;
	height: 47px;
	margin: 0px auto;
	overflow: hidden;
	float: left;
}

#header_tab  .header_div_id {
	width: 728px;
	height: 47px;
	overflow: hidden;
	position: relative;
	float: left;
}

.header_tipsWindow {
	width: 120px;
	height: 15px;
	border: 1px #57B3E4 solid;
	position: absolute;
	display: none;
	background: #FFFFFF;
	font-size: 12px;
	padding: 2px;
	color: #999999;
	text-align: center;
}

.currentModule {
	width: 100px;
	text-align: center;
	color:#ffffff;
	font-size:14px;
}
</style>
<script language="javascript" src="../../scripts/ssoInfo.js"></script>
<c:set var="eas" value="<%=Constants.EAS%>" />
<c:set var="integrationStyle"
	value="<%=Constants.INTEGRATION_STYLE_EAS%>" />
<c:set var="mcount" value="9" />
<%--<input type="button" value="设置" onclick="setting();"/>--%>
<%--<input type="button" id="save" value="保存" onclick="save();"/>--%>
<%-- R110621-0158 PT051822 2011-9-26 xiaofei_zhang  集成OA_V6.1如果安装了集成档案系统后，菜单会展现不全  增加  eas&&integrationStyle==2&&isarchive 参数--%>
<c:if
	test="${!eas||(eas&&integrationStyle!=2) || (eas && integrationStyle==2 && sessionScope.loginFrom == 'oa')}">
	<table width="100%" height="36" cellspacing="0" cellpadding="0"
		border="0" id="header_table">
		<tr class="top_menu_bg">
			<td >
				&nbsp;
			</td>
			<td width="736px">
				<div id="header_tab">
					<div id="header_div" class="header_div_id">
						<div id="headerList">
							<c:forEach items="${pages}" var="page">
								<c:if test="${page.pageType == 0}">
									<c:if test="${page.pageCode != 'M9'}">
									<div id="headerList_${page.id}-${page.pageType}" name="headerList_navigation">
										<div pageId="${page.id}" id="divMenu_${page.id}"
											onMouseOver="overMenu(this,${page.id},null,'${page.pageType}')"
											onMouseOut="outMenu(this,${page.id},null,'${page.pageType}')">
											<table height="47" cellspacing="0" cellpadding="0" border="0" onmouseover="theMouseMove(this);">
												<tr>
													<td
														<c:if test="${page.id != currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_menu_line"</c:if>>
													</td>
													<td nowrap="nowrap" onclick="goToUrl('<c:url value="${page.url}" />',this)" 
														<c:if test="${page.id!=currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_Menu" </c:if>
														<c:if test="${page.id==currentPage.id && page.pageType==currentPage.pageType}">class="top_menu_on_bg" </c:if>>
															<span id="a_${page.id}">
																<c:choose>
										              				<c:when test="${page.defType == 1}"><%-- 个人门户使用国际化 --%>
										              					${portal_header_top_label1 }
										              				</c:when>
										              				<c:otherwise>
										              					${page.pageName}
										              				</c:otherwise>
										              			</c:choose>
															</span>
													</td>
												</tr>
											</table>
										</div>
									</div>
									</c:if>
									<c:if test="${isarchive == true && page.pageCode == 'M9'}">
									<div id="headerList_${page.id}-${page.pageType}" name="headerList_navigation">
										<div pageId="${page.id}" id="divMenu_${page.id}"
											onMouseOver="overMenu(this,${page.id},null,'${page.pageType}')"
											onMouseOut="outMenu(this,${page.id},null,'${page.pageType}')">
											<table height="47" cellspacing="0" cellpadding="0" border="0" onmouseover="theMouseMove(this);">
												<tr>
													<td
														<c:if test="${page.id != currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_menu_line"</c:if>>
													</td>
													<td nowrap="nowrap" onclick="goToUrlOpenNew('<c:url value="/modules/portal/login_archive.jsp" />',this)" target="_blank" 
														<c:if test="${page.id!=currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_Menu" </c:if>
														<c:if test="${page.id==currentPage.id && page.pageType==currentPage.pageType}">class="top_menu_on_bg" </c:if>>
															<span id="a_${page.id}">${page.pageName}</span>
													</td>
												</tr>
											</table>
										</div>
									</div>
									</c:if>
								</c:if>
								<c:if test="${page.pageType == 1}">
									<c:if test="${fn:length(page.modules)>0}">
										<div id="headerList_${page.id}-${page.pageType}" name="headerList_navigation">
											<div id="divMenu_${page.id}"
												onMouseOver="overMenu(this,${page.id},'divMenu_${page.id}','${page.pageType}');"
												onMouseOut="outMenu(this,${page.id},'moduleMenu_${page.id}',null,'${page.pageType}');">
												<table height="47" cellspacing="0" cellpadding="0" border="0" onmouseover="theMouseMove(this);">
													<tr>
														<td
															<c:if test="${page.id != currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_menu_line"</c:if>>
														</td>
														<td nowrap="nowrap" onclick="goToUrl('<c:url value="${page.url}" />',this)" target="${page.modules[0].target==''?'_self':page.modules[0].target}"
															<c:if test="${page.id!=currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_Menu" </c:if>
															<c:if test="${page.id==currentPage.id && page.pageType==currentPage.pageType}">class="top_menu_on_bg" </c:if>>
																<span id="a_${page.id}">${page.pageName}</span>
														</td>
													</tr>
												</table>
											</div>
										</div>
									</c:if>
								</c:if>

								<!-- 
								RMP:R111009-0412,shaohua_jiang,K/3ERP门户集成回迁v6.1
								DMP:PT056358,2011-11-01
							 -->
								<c:if test="${page.pageType == 2}">
									<c:if test="${fn:length(page.modules)>0}">
										<div id="headerList_${page.id}-${page.pageType}" name="headerList_navigation">
											<div id="divMenu_${page.id}"
												onMouseOver="overMenu(this,${page.id},'divMenu_${page.id}','${page.pageType}');"
												onMouseOut="outMenu(this,${page.id},'moduleMenu_${page.id}',null,'${page.pageType}');">
												<table height="47" cellspacing="0" cellpadding="0" border="0" onmouseover="theMouseMove(this);">
													<tr>
														<td
															<c:if test="${page.id != currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_menu_line"</c:if>>
														</td>
														<td nowrap="nowrap"
															<c:if test="${page.id!=currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_Menu" </c:if>
															<c:if test="${page.id==currentPage.id && page.pageType==currentPage.pageType}">class="top_menu_on_bg" </c:if>>
														<c:if test="${page.id==currentPage.id && page.pageType==currentPage.pageType}">${page.pageName}</c:if>
															<c:if test="${page.id!=currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">${page.pageName}</c:if>
														</td>
													</tr>
												</table>
												<%--<div id="moduleMenu_${page.id}" class="module_more_main"  style="display: none">
										<c:forEach items="${page.modules}" var="module">
										<div id="yyy_${module.id}" class="module_menu_option"  title="<spring:message code="module_${module.moduleId}" text="${module.name}"/>"
											onmouseover="this.className='module_menu_selected';"
											onmouseout="this.className='module_menu_option';" <c:if test="${module.isChooseSob == 1}">onclick="showDiv(this,${module.sysConfId})"</c:if> >
												<c:if test="${module.isChooseSob == 0}">
													<a id="a_${module.id}"  target="${module.target==''?'_self':module.target}" class="link_top"  href="<c:url value="/modules/portal/k3erpLogin.do?method=onK3ERPLogin&sysConfId=${module.sysConfId}&defaultSob=${module.defaultSob}" />">
														<spring:message code="module_${module.moduleId}" text="${module.name}"/>
													</a>
												</c:if>
												<c:if test="${module.isChooseSob == 1}">
													<spring:message code="module_${module.moduleId}" text="${module.name}"/>
												</c:if>
										</div>
										</c:forEach>
									</div>
									<script language="JavaScript" type="text/JavaScript">
										addIframe($('moduleMenu_${page.id}'));
									</script>
								--%>
											</div>
										</div>
									</c:if>
								</c:if>
								<!--					BI集成 baojun_wei 2011-4-12-->
								<c:if test="${page.pageType == 3 }">
									<div id="headerList_${page.id}-${page.pageType}" name="headerList_navigation">
										<div id="divMenu_${page.id}"
											onMouseOver="overMenu(this,${page.id},null,'${page.pageType}')"
											onMouseOut="outMenu(this,${page.id},null,'${page.pageType}')">
											<table height="47" cellspacing="0" cellpadding="0" border="0" onmouseover="theMouseMove(this);">
												<tr>
													<td
														<c:if test="${page.id != currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_menu_line"</c:if>>
													</td>
													<td nowrap="nowrap" onclick="goToUrl('<c:url value="${page.url}" />',this)"
														<c:if test="${page.id!=currentPage.id || (page.id==currentPage.id &&page.pageType!=currentPage.pageType)}">class="top_Menu" </c:if>
														<c:if test="${page.id==currentPage.id && page.pageType==currentPage.pageType}">class="top_menu_on_bg" </c:if>>
															<span id="a_${page.id}">${page.pageName}</span>
													</td>
												</tr>
											</table>
										</div>
									</div>
								</c:if>
								<!-- 模块菜单 dexiang_lei-->
								<c:if test="${page.pageType == 99 }">
									<div id="headerList_${page.id}-${page.pageType}" name="headerList_navigation">
										<div id="divMenu_${page.id}"
											onMouseOver="overMenu(this,${page.id},null,'${page.pageType}')"
											onMouseOut="outMenu(this,${page.id},null,'${page.pageType}')">
											<table height="47" cellspacing="0" cellpadding="0" border="0" onmouseover="theMouseMove(this);">
												<tr>
													<td
														<c:if test="${page.sid != currentPage.pageCode}">class="top_menu_line"</c:if>>
													</td>
													<td nowrap="nowrap" onclick="goToUrl('<c:url value="${page.url}" />',this)"
														<c:if test="${page.sid!=currentPage.pageCode}">class="top_Menu" </c:if>
														<c:if test="${page.sid==currentPage.pageCode}">class="top_menu_on_bg" </c:if>>
															<span id="a_${page.id}"><spring:message code="module_${page.id}" text="${page.pageName}"/></span>
													</td>
												</tr>
											</table>
										</div>
									</div>
								</c:if>

							</c:forEach>
						</div>
					</div>
				</div>
			</td>
			<!-- 快捷图标 -->
			<td align="center">
				<table border="0" cellspacing="0" cellpadding="0" height="100%" >
					<tr >
						<td >
							<table>
								<tr>
									<td id="menu_move_left_id" class="menu_move_left" onmouseover="this.className='menuover_move_left'" onmouseout="this.className='menu_move_left'" onclick="menuMoveLeftFunc();">
									</td>
								</tr>
							</table>
						</td>
						<td >
							<table>
								<tr>
									<td id="menu_move_right_id" class="menu_move_right" onmouseover="this.className='menuover_move_right'" onmouseout="this.className='menu_move_right'" onclick="menuMoveRightFunc();">
									</td>
								</tr>
							</table>
						</td>
						<td id="current_module" class="currentModule">
							<c:if test="${currentPage.pos == null }">
								<table height="47" cellspacing="0" cellpadding="0" border="0">
									<tr>
										<td class="top_menu_on_bg" onclick="goToUrl('<c:url value="${currentmoduleObj.url}" />',this)" style="cursor: pointer;">
											<span id="a_${currentmoduleObj.id}">
												<spring:message code="module_${currentmoduleObj.id}" text="${currentmoduleObj.name}"/>
											</span>
										</td>
									</tr>
								</table>
							</c:if>
						</td>
						<td >
							<table id="menu_favorite" title="<spring:message text="快捷菜单" code="user_shortcut_label5" />" class="menu_favorite" onmouseover="this.className='menuover_favorite'" onmouseout="this.className='menu_favorite'">
								<tr>
									<td>
										
									</td>
								</tr>
							</table>
						</td>
						<td >
							<div id="menu_favorite_details"  ></div>
						</td>
						<td >
							<table height="47px" >
								<tr >
									<td valign="middle">
										<span class="menu_shortline" style="height: 36px"></span>
									</td>
								</tr>
							</table>
						</td>
						<td >
					
							<div id="menu_all" title="<spring:message code="user_shortcut_label6" text="系统导航" />" class="menu_all" onmouseover="this.className='menuover_all'" onmouseout="this.className='menu_all'">
							</div>
						</td>
						<td>
							<div id="menu_all_details" style="position: absolute;" ></div>
						</td>
					</tr>
				</table>
			</td>

		</tr>
	</table>
	
</c:if>


<c:if test="${eas&&integrationStyle==2&&sessionScope.loginFrom == null}">
<style>
.top_bg{
background:url();
border-top-width: 0px;
}
</style>
<c:if test="${!empty param.portalviewwin}">
	<table width="100%"  border="0" bgcolor="#7E7E7E">
		<tr align="center">
			<td onclick="hideView()">
					<a style="position:absolute;z-index:999;text-decoration:none;" href="#" onclick="hideView()">
						<font style="font-weight:bold;font-size:16px;color:red;">${portal_header_top_label14}</font>
					</a>
			</td>
		</tr>
	</table>
	<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#7E7E7E">
		<tr align="center">
			<td>
					&nbsp;
			</td>
		</tr>
	</table>
</c:if>
<table width="100%" cellspacing="0" cellpadding="0" border="0" height="23" id="tbl_SubMenu_1" style="display: inline;">
	<tr>
		<td width="5" bgcolor="#ffffff">&nbsp;</td>
		<td class="sub_menu_left">&nbsp;</td>
		<td class="sub_menu_middle">

		<table height="23" cellspacing="0" cellpadding="0" border="0">
			<tr>
				<td width="20">&nbsp;</td>

				<c:if test="${isarchive}">
					<td>
						<div id="div_SubMenu_archive" onMouseOver="overSubMenu(this,'div_SubMenu_archive')" onMouseOut="outSubMenu(this,'div_SubMenu_archive')">
							<table height="23" cellspacing="0" cellpadding="0" border="0">
								<td width="4">&nbsp;</td>
								<td width="50" valign="center" nowrap="nowrap"><a id="a_archive"  id="a_archive"  class="link_top_subMenu" onmouseup="goToUrlOpenNew('<c:url value="/modules/portal/login_archive.jsp" />',this);" href="javascript:void(0);" >
									<spring:message code="module_archive" text="档案系统"/>
								</a></td>
								<td width="4">&nbsp;</td>
							</table>
						</div>				
					</td>
					<td width="20" align="center"></td>
				</c:if>
				<c:forEach items="${pages}" var="page">
					<c:if test="${page.pageType == 99 }">
					<td>
						<div id="div_SubMenu_${page.id}" <c:if test="${page.sid != currentPage.pageCode}">onMouseOver="overSubMenu(this,${page.id})" onMouseOut="outSubMenu(this,${page.id})" </c:if>>
							<table height="23" cellspacing="0" cellpadding="0" border="0">
								<td width="4" <c:if test="${page.sid == currentPage.pageCode}">class="selSubMenu_left"</c:if>>&nbsp;</td>
								<td width="50" valign="center" nowrap="nowrap"
									<c:if test="${page.sid == currentPage.pageCode}">class="selSubMenu_middle"</c:if>
									<c:if test="${page.sid == currentPage.pageCode}">class="subMenu_td"</c:if>
								><a id="a_${page.id}"  id="a_${page.id}"  class="link_top_subMenu" onmouseup="goToUrl('<c:url value="${page.url}" />',this);" href="javascript:void(0);" >
									<spring:message code="module_${page.id}" text="${page.pageName}"/>
								</a></td>
								<td width="4" <c:if test="${page.sid == currentPage.pageCode}">class="selSubMenu_right"</c:if>>&nbsp;</td>
							</table>
						</div>				</td>
					<td width="20" align="center"></td>
					</c:if>
				</c:forEach>
				<td>
						<div id="div_SubMenu_more" >
							<table height="23" cellspacing="0" cellpadding="0" border="0">
								<td width="4"  >&nbsp;</td>
								<td width="40" valign="center" nowrap="nowrap" >
								<div id="menu_all" style="cursor:pointer;" title="<spring:message code="user_shortcut_label6" text="系统导航" />">
									<img border="0" src="<c:url value="/themes/mskin/images/more_2.gif"/>" >
								</div>
								</td>
								<td>
									<div id="menu_all_details" style="position: absolute;" ></div>
								</td>
							</table>
						</div>				
				</td>
				<td>
						<div id="div_SubMenu_more" >
							<table height="23" cellspacing="0" cellpadding="0" border="0">
								<tr>
									<td >
										<table  style="cursor:pointer;"id="menu_favorite" title="<spring:message text="快捷菜单" code="user_shortcut_label5" />" >
											<tr>
												<td>
													<img src="../../themes/${sessionScope.loginUser.theme}/images/workflow_save.gif" width="14" height="14" hspace="2" border="0" align="absmiddle">
												</td>
											</tr>
										</table>
									</td>
									<td >
										<div id="menu_favorite_details"  ></div>
									</td>
								</tr>
							</table>
						</div>				
				</td>
				
						
				
				<td width="40" align="center"></td>
			</tr>
		</table>
		</td>
		<td class="sub_menu_right">&nbsp;</td>
		<td width="5" bgcolor="#ffffff">&nbsp;</td>
	</tr>
</table>

<script language="javascript" type="text/javascript">
function conMenuLast(){
	var d = document.getElementById('divOther');
	if('none' == d.style.display){
		d.style.display = '';
	}else{
		d.style.display = 'none';
	}
}

function hideView(){
	parent.document.getElementById("topDialog").style.display = "none";
	parent.document.getElementById("topBlackdiv").style.display = "none";
	parent.document.getElementById("topDialogIframe").src = "";
}
</script>

</c:if>

<script language="javascript">
jQuery(function(){
  //定义每个面板显示8个菜单


  var visbleItemCount = new Number(7);
  //获得LI元素的总个数


  var total = new Number(jQuery("#headerList div[name='headerList_navigation']").length);  
  //每次向左移动的单元个数


  var everyTimeMoveCount_left = new Number(3); 
  //最后一次向左移动的单元个数
  var lastTimeMoveCount_left ;
  //向左移动了多少次
  var leftMoveTimeCount ;
  //需要向左移动的次数
  var needMoveTime_left = 0;
  var havedMovedTime_right = 0;
  //每次向右移动的单元个数


  var everyTimeMoveCount_right = new Number(3); 
  //最后一次向右移动的单元个数
  var lastTimeMoveCount_right ;
  //向右移动了多少次
  var rightMoveTimeCount ;
  //需要向右移动的次数
  var needMoveTime_right;
  //每次移动的宽度


  var scrollWidth =new Number(jQuery("#header_div").width())/visbleItemCount; 
  //当前page的位置顺序号 
  var currentPos = new Number('${currentPage.TPos}');
  currentPos = currentPos + 1;
  //貌似没有用


  var isDefault = '${currentPage.isUserPageDefaultType}';
  
  
  
  //移动到当前选中导航的位置


  moveToCheckedItemPosition();
  function moveToCheckedItemPosition() {
  	var runMovePositionFunc = Get_Cookie("movePositionInMenuAllDetail");
  	if(runMovePositionFunc == 'movePositionInMenuAllDetail' ) {
  		//通过点击全导航快捷菜单进来处理的函数
  		//alert("执行movePositionInMenuAllDetail方法");
  		movePositionInMenuAllDetail();
  		Delete_Cookie("movePositionInMenuAllDetail",'/','');
  		var leftMoveTimeCount_ = getDefaultCount("leftMoveTimeCount");
  		var rightMoveTimeCount_ = getDefaultCount("rightMoveTimeCount");
  		if(leftMoveTimeCount_ > rightMoveTimeCount_) {
  			Set_Cookie("leftMoveTimeCount", 0, '', '/', '', '');
  			Set_Cookie("rightMoveTimeCount", 0, '', '/', '', '');
  			leftMoveTimeCount = 0;
  			rightMoveTimeCount = 0;
  		}
  		//--alert("执行完movePositionInMenuAllDetail并resetCookie后向左向右的次数："+getDefaultCount("leftMoveTimeCount")+"...."+getDefaultCount("rightMoveTimeCount"));
  	}else if('${param.fromNavigation}' != 'true' ) {
  		//通过点击全导航快捷菜单进来处理的函数
  		//alert("执行movePositionInMenuAllDetail方法");
  		movePositionInMenuAllDetail();
  		Delete_Cookie("movePositionInMenuAllDetail",'/','');
  		var leftMoveTimeCount_ = getDefaultCount("leftMoveTimeCount");
  		var rightMoveTimeCount_ = getDefaultCount("rightMoveTimeCount");
  		if(leftMoveTimeCount_ > rightMoveTimeCount_) {
  			Set_Cookie("leftMoveTimeCount", 0, '', '/', '', '');
  			Set_Cookie("rightMoveTimeCount", 0, '', '/', '', '');
  			leftMoveTimeCount = 0;
  			rightMoveTimeCount = 0;
  		}
  	}else {
  		//通过点击导航上的菜单进来处理的函数


  		//alert("执行movePostion方法");
  		movePostion();
  	}
  }
  
  function checkCurrentPageIsInCurrentScreen(leftMoveTimeCount_,rightMoveTimeCount_) {
  	var cur = 'headerList_' + '${currentPage.id}' + '-' + '${currentPage.pageType}';
  	var curObj = document.getElementById(cur);
	var curObj_left = getAbsoluteLocationEx(curObj).absoluteLeft;
	var movelr = leftMoveTimeCount_ - rightMoveTimeCount_;
	if(movelr < 0) {
		scrollWidth * Math.abs(movelr)
	}
	  	
  }
  
  function movePostion() {
  	var leftMoveTimeCount_ = getDefaultCount("leftMoveTimeCount");
  	var rightMoveTimeCount_ = getDefaultCount("rightMoveTimeCount");
  	//--alert("执行movePostion中的向左向右的次数："+leftMoveTimeCount_+" .... "+rightMoveTimeCount_);
  	if(leftMoveTimeCount_ > rightMoveTimeCount_) {
  		//仅在通过全导航菜单操作时才用到
  		jQuery("#headerList").css({left : "+=" + (scrollWidth*(leftMoveTimeCount_ - rightMoveTimeCount_)) +"px"});
  		needMoveTime_left = 0;
  		lastTimeMoveCount_left = 0;
  		lastTimeMoveCount_right = (total - visbleItemCount)%everyTimeMoveCount_right;
  		needMoveTime_right = Math.ceil((total - visbleItemCount)/everyTimeMoveCount_right);
  		Set_Cookie("rightMoveTimeCount", 0, '', '/', '', '');
  		Set_Cookie("leftMoveTimeCount", 0, '', '/', '', '');
  	} else if(leftMoveTimeCount_ < rightMoveTimeCount_) {
  		//目前向右移动的次数
  		var moveRightCount = rightMoveTimeCount_ - leftMoveTimeCount_;
  		needMoveTime_left = Math.ceil(moveRightCount/everyTimeMoveCount_left);
  		lastTimeMoveCount_left = moveRightCount%everyTimeMoveCount_left;
  		needMoveTime_right = Math.ceil((total - moveRightCount - visbleItemCount)/everyTimeMoveCount_right);
  		lastTimeMoveCount_right = (total - moveRightCount - visbleItemCount)%everyTimeMoveCount_right;
  		jQuery("#headerList").css({left : "-" + (scrollWidth*moveRightCount) +"px"});
  		Set_Cookie("rightMoveTimeCount", moveRightCount, '', '/', '', '');
  		Set_Cookie("leftMoveTimeCount", 0, '', '/', '', '');
  		
  	} else if(parseInt(leftMoveTimeCount_) == parseInt(rightMoveTimeCount_)) {
  		lastTimeMoveCount_left = 0;
  		needMoveTime_left = 0;
  		lastTimeMoveCount_right = (total - visbleItemCount)%everyTimeMoveCount_right;
  		needMoveTime_right = Math.ceil(moreToZero(total - visbleItemCount)/everyTimeMoveCount_right);
  		leftMoveTimeCount = 0;
  		rightMoveTimeCount = 0;
  		Set_Cookie("rightMoveTimeCount", 0, '', '/', '', '');
  		Set_Cookie("leftMoveTimeCount", 0, '', '/', '', '');
  		if(currentPos <= visbleItemCount) {
  			jQuery("#headerList").css({left : "+" + (scrollWidth*(leftMoveTimeCount_ - rightMoveTimeCount_)) +"px"});
  		}
  	} 
  	//判断移到左边导航末尾时，类似禁灰显示
  		if(needMoveTime_left == 0) {
  			jQuery("#menu_move_left_id").attr("class","menugray_move_left");
			jQuery("#menu_move_left_id").mouseover(function(){
				this.className = "menugray_move_left";
			});
			jQuery("#menu_move_left_id").mouseout(function(){
				this.className = "menugray_move_left";
			});
  		}
  	//判断移到右边导航末尾时，类似禁灰显示
  		if(needMoveTime_right == 0) {
  			jQuery("#menu_move_right_id").attr("class","menugray_move_right");
			jQuery("#menu_move_right_id").mouseover(function(){
				this.className = "menugray_move_right";
			});
			jQuery("#menu_move_right_id").mouseout(function(){
				this.className = "menugray_move_right";
			});
  		}
  	//--alert("执行完movePostion后向左向右的次数："+getDefaultCount("leftMoveTimeCount")+"...."+getDefaultCount("rightMoveTimeCount"));
  	//--alert("执行完movePostion后最后一次向左移动的单元次数和需要向左移动的次数："+lastTimeMoveCount_left+"......."+needMoveTime_left);
  	//--alert("执行完movePostion后最后一次向右移动的单元次数和需要向右移动的次数："+lastTimeMoveCount_right+"......."+needMoveTime_right);
  }
  
  //如果该数小于0则返回0,否则返回原来
  function moreToZero(val) {
  	if(val < 0) {
  		return 0;
  	}else {
  		return val;
  	}
  }
  
  function movePositionInMenuAllDetail() {
  		resetRightLeftMoveCountInMenuAllDetail(currentPos);
  	//--alert("movePositionInMenuAllDetail中左右移动的单元数："+getDefaultCount("leftMoveTimeCount")+"...."+getDefaultCount("rightMoveTimeCount"));
  		movePostion();
  }
  
  
  function getDefaultCount(cookieName) {
  	var temp = Get_Cookie(cookieName);
  	if(temp == 'NaN')alert('出现异常了NaN');
  	if(temp == null || temp == '' || isNaN(temp)) {
  		temp = new Number(0);
  	}else {
  		temp = new Number(temp);
  	}
  	return temp;
  }
  
  //根据当前位置重置向左向右的单元数
  function resetRightLeftMoveCountInMenuAllDetail(currentPos) {
  //alert(currentPos+"  "+getMoveCount(currentPos));
  	if(currentPos > visbleItemCount) {
  			Set_Cookie("rightMoveTimeCount", getMoveCount(currentPos), '', '/', '', '');
  			Set_Cookie("leftMoveTimeCount", 0, '', '/', '', '');
  		} else if(currentPos < visbleItemCount) {
  			var leftCount_ = getDefaultCount("leftMoveTimeCount");
  			var rightCount_ = getDefaultCount("rightMoveTimeCount");
  			if(isNaN(leftCount_))leftCount_ = 0;
  			if(parseInt(leftCount_) == parseInt(rightCount_)) {
  				Set_Cookie("leftMoveTimeCount", 0, '', '/', '', '');
  			}else {
  				Set_Cookie("leftMoveTimeCount", getMoveCount(currentPos), '', '/', '', '');
  			}
  			Set_Cookie("rightMoveTimeCount", 0, '', '/', '', '');
  		}
  }
  
  
  
  
  //根据当前位置获取移动的单元数（everyTimeMoveCount_right == everyTimeMoveCount_left适用）


  function getMoveCount(currentPos) {
  	//共需向右滚动的次数


  	var rn = Math.ceil(Math.abs(currentPos - visbleItemCount)/everyTimeMoveCount_right);
  	//alert("共需滚动的次数rn:"+rn);
  	//第n次移动需要的单元数


  	var lrc;
  	var lrc_ = Math.abs(currentPos - visbleItemCount)%everyTimeMoveCount_right;
  	if(lrc_ == 0) {
  		if(currentPos - visbleItemCount >= 0) {
  			lrc = 3;
  		}else {
  			lrc = 0;
  		}
  	}else {
  		lrc = lrc_;
  	}
  	//alert("第n次移动需要的单元数:"+lrc);
  	//alert("根据当前位置获取移动的单元数:"+(lrc + everyTimeMoveCount_right*((rn - 1)<0?0:(rn - 1))));
  	//if(isNaN(lrc + everyTimeMoveCount_right*(rn - 1)))alert("getMoveCount NaN");
  	return (lrc + everyTimeMoveCount_right*((rn - 1)<0?0:(rn - 1)));
  }
  
  
  
  //导航向左滚动
  menuMoveLeftFunc = function(){
	  if(!jQuery("#headerList").is(":animated")){
	  		leftMoveTimeCount = getDefaultCount("leftMoveTimeCount");
	  		//判断移到左边导航末尾时，类似禁灰显示
	  		if(needMoveTime_left == 1) {
	  			jQuery("#menu_move_left_id").attr("class","menugray_move_left");
				jQuery("#menu_move_left_id").mouseover(function(){
					this.className = "menugray_move_left";
				});
				jQuery("#menu_move_left_id").mouseout(function(){
					this.className = "menugray_move_left";
				});
	  		}
	  		//判断移到右边导航末尾时，类似禁灰显示
	  		if(needMoveTime_right >= 0 && total > visbleItemCount) {
	  			jQuery("#menu_move_right_id").attr("class","menu_move_right");
				jQuery("#menu_move_right_id").mouseover(function(){
					this.className = "menuover_move_right";
				});
				jQuery("#menu_move_right_id").mouseout(function(){
					this.className = "menu_move_right";
				});
	  		}
	  		
		   if(needMoveTime_left == 0){
			   jQuery("#headerList").stop();
			}else if(needMoveTime_left == 1 && lastTimeMoveCount_left != 0) {
			   jQuery("#headerList").animate({left : "+=" + scrollWidth*lastTimeMoveCount_left +"px"},500);
			   leftMoveTimeCount = leftMoveTimeCount + lastTimeMoveCount_left;
			   needMoveTime_left--;
			   lastTimeMoveCount_left = 0;
			   Set_Cookie("leftMoveTimeCount", leftMoveTimeCount,  '', '/', '', '');
		   }else {
			   jQuery("#headerList").animate({left : "+=" + scrollWidth*everyTimeMoveCount_left +"px"},500);
			   leftMoveTimeCount = leftMoveTimeCount + everyTimeMoveCount_left;
			   needMoveTime_left--;
			   Set_Cookie("leftMoveTimeCount", leftMoveTimeCount, '', '/', '', '');
		   }
		   var leftMoveTimeCount_ = leftMoveTimeCount;
 		   var rightMoveTimeCount_ = getDefaultCount("rightMoveTimeCount");
 		   var moveRightCount = Math.abs(rightMoveTimeCount_ - leftMoveTimeCount_);
		   lastTimeMoveCount_right = (total - moveRightCount - visbleItemCount)%everyTimeMoveCount_right;
		   needMoveTime_right = Math.ceil(moreToZero(total - moveRightCount - visbleItemCount)/everyTimeMoveCount_right);
		   if(leftMoveTimeCount_ == null)alert("共向左移动的单元次数："+leftMoveTimeCount_);
		   if(rightMoveTimeCount_ == null)alert("共向右移动的单元次数："+rightMoveTimeCount_);
		   if(lastTimeMoveCount_right == null)alert("向左滚动完后,最后一次向右滚动的单元数："+lastTimeMoveCount_right);
		   if(lastTimeMoveCount_left == null)alert("向左滚动完后,最后一次向左滚动的单元数："+lastTimeMoveCount_left);
		   if(needMoveTime_right == null)alert("向左滚动完后,还可以向右移动的次数："+needMoveTime_right);
		   if(needMoveTime_left == null)alert("向左滚动完后,还可以向左移动的次数："+needMoveTime_left);
		   //--alert("共向左移动的单元次数："+leftMoveTimeCount_+"  共向右移动的单元次数："+rightMoveTimeCount_);
		   //--alert("向左滚动完后,最后一次向右滚动的单元数："+lastTimeMoveCount_right + "最后一次向左滚动的单元数："+lastTimeMoveCount_left);
		 //-- alert("向左滚动完后,还可以向右移动的次数:"+needMoveTime_right + "还可以向左移动的次数:"+needMoveTime_left);
	   }
  }
  
  //导航向右滚动
  menuMoveRightFunc = function(){
  	//printJsEventToConsole();
	   if(!jQuery("#headerList").is(":animated")){
	  		rightMoveTimeCount = getDefaultCount("rightMoveTimeCount");
	  		//判断移到右边导航末尾时，类似禁灰显示
	  		if(needMoveTime_right == 1) {
	  			jQuery("#menu_move_right_id").attr("class","menugray_move_right");
				jQuery("#menu_move_right_id").mouseover(function(){
					this.className = "menugray_move_right";
				});
				jQuery("#menu_move_right_id").mouseout(function(){
					this.className = "menugray_move_right";
				});
	  		}
	  		//判断移到左边导航末尾时，类似禁灰显示
	  		if(needMoveTime_left >= 0 && total > visbleItemCount) {
	  			jQuery("#menu_move_left_id").attr("class","menu_move_left");
				jQuery("#menu_move_left_id").mouseover(function(){
					this.className = "menuover_move_left";
				});
				jQuery("#menu_move_left_id").mouseout(function(){
					this.className = "menu_move_left";
				});
	  		}
	  		
	  		
		   if(needMoveTime_right == 0 ){
			    jQuery("#headerList").stop();
		   }else if(needMoveTime_right == 1 && lastTimeMoveCount_right != 0) {
			    jQuery("#headerList").animate({left : "-=" + scrollWidth*lastTimeMoveCount_right +"px"},500);
			    if(rightMoveTimeCount == null)alert("rightMoveTimeCount:"+rightMoveTimeCount);
			    rightMoveTimeCount = rightMoveTimeCount + lastTimeMoveCount_right;
			    needMoveTime_right--;
			    lastTimeMoveCount_right = 0;
			    Set_Cookie("rightMoveTimeCount", rightMoveTimeCount,  '', '/', '', '');  
		   }else {
		   
			    jQuery("#headerList").animate({left : "-=" + scrollWidth*everyTimeMoveCount_right +"px"},500);
			    if(rightMoveTimeCount == null)alert("rightMoveTimeCount:"+rightMoveTimeCount);
			    rightMoveTimeCount = rightMoveTimeCount + everyTimeMoveCount_right;
			    needMoveTime_right--;
			    Set_Cookie("rightMoveTimeCount", rightMoveTimeCount,  '', '/', '', '');  
		   }
		   var leftMoveTimeCount_ = getDefaultCount("leftMoveTimeCount");
  		   var rightMoveTimeCount_ = rightMoveTimeCount;
  		   var moveRightCount = Math.abs(rightMoveTimeCount_ - leftMoveTimeCount_);
		   lastTimeMoveCount_left = moveRightCount%everyTimeMoveCount_left;
		   needMoveTime_left = Math.ceil(moveRightCount/everyTimeMoveCount_left);
		   if(leftMoveTimeCount_ == null )alert("共向左移动的单元次数2："+leftMoveTimeCount_);
		   if(rightMoveTimeCount_== null )alert("共向右移动的单元次数2："+rightMoveTimeCount_);
		   if(lastTimeMoveCount_right== null )alert("向左滚动完后,最后一次向右滚动的单元数2："+lastTimeMoveCount_right);
		   if(lastTimeMoveCount_left== null )alert("向左滚动完后,最后一次向左滚动的单元数2："+lastTimeMoveCount_left);
		   if(needMoveTime_right== null )alert("向右滚动完后,还可以向左移动的次数2："+needMoveTime_right);
		   if(needMoveTime_left== null )alert("向左滚动完后,还可以向右移动的次数2："+needMoveTime_left);
		   //--alert("共向左移动的单元次数："+leftMoveTimeCount_+"  共向右移动的单元次数："+rightMoveTimeCount_);
		  //-- alert("向右滚动完后,最后一次向左滚动的单元数："+lastTimeMoveCount_left + "最后一次向右滚动的单元数："+lastTimeMoveCount_right);
		 //-- alert("向右滚动完后,还可以向左移动的次数:"+ needMoveTime_left + "还可以向右移动的次数:"+needMoveTime_right);
	   }
  }
  
  printJsEventToConsole = function() {
  	new Ajax.Request(
			'<c:url value="/modules/portlet/portletService.do?method=printJsEventToConsole&openwin=true"/>',
				{
					method: 'post',
					onComplete: function(transport) {
					},
					onFailure: function() {		
					}
				}
		);	
  }
  
  jQuery("#menu_favorite").click(function(e){
	 //headerTab_loadTabInfo('106','106',e.pageX-250,e.pageY); //106为快捷应用


	 headerTab_showFastMenu(e.pageX-250,e.pageY);
	 jQuery(document).bind('click',{fastMenu: false},getDocumentClickEvent);
  });
  
  var timeout;
  jQuery("#menu_favorite_details").mouseover(function(){
			showMenuFavoriteDetails();
		}).mouseout(function(){
			timeout = setTimeout(hideMenuFavoriteDetails, 800);	
		}); 
		
  function showMenuFavoriteDetails(){
	clearTimeout(timeout);
  	jQuery("#menu_favorite_details").show();	
  	jQuery(document).unbind('click');
  	jQuery(document).bind('click',{fastMenu: true},getDocumentClickEvent);
  }
		
  function hideMenuFavoriteDetails(){
  	clearTimeout(timeout);
  	jQuery("#menu_favorite_details").hide();
  	jQuery(document).unbind('click');
  }
  
	var firstTimeMenuAllClick = true;
	jQuery.ajaxSetup({cache: false});
   jQuery("#menu_all").click(function(e){
   var menu_all_left = new Number(jQuery("#menu_all").offset().left);
   //alert((menu_all_left-343+20));
   		if(firstTimeMenuAllClick) {
		    var menuAllDetail = '<c:url value="/modules/portal/page.do?method=loadMenuAllDetail&openwin=true"/>';
			jQuery('#menu_all_details').load(menuAllDetail,{'portalwin':true},function(response, status1, xhr){
				if(status1 == 'success') {
					 jQuery("#menu_all_details").css({
						"top"		: '<%=topHeight%>' +"px",
					    "opacity"	: "0.9",
					     "width"	: "343px",
						"display" 	: "block",
						"position" 	: "absolute" ,
						"z-index"	: "888"
					});
					var menu_all_detail_width = new Number(jQuery("#menu_all_details").width());
					var menu_all_width = new Number(jQuery("#menu_all").width());
					//alert((menu_all_left-menu_all_detail_width+menu_all_width));
					var menuWidth = menu_all_left-menu_all_detail_width+menu_all_width;
					if(menuWidth < 0){
						menuWidth = 10;
					}
					jQuery("#menu_all_details").css({"left":(menuWidth)+"px"});
					jQuery("#menu_all_details_iframe").attr("height",jQuery("#menu_all_details").height());
					jQuery("#menu_all_details_iframe").attr("width",jQuery("#menu_all_details").width());
				}
			});
			firstTimeMenuAllClick = false;
		}
    	jQuery(document).bind('click',{menuAll:false}, getDocumentClickEvent);
	  	timeout = setTimeout(showMenuAllDetails2,100);
   });
   
   jQuery("#menu_all_details").mouseover(function(){
   		showMenuAllDetails();
	}).mouseout(function(){
		timeout = setTimeout(hideMenuAllDetails, 800);	
	}); 
	
	function showMenuAllDetails() {
		clearTimeout(timeout);
		jQuery("#menu_all_details").show();
		jQuery(document).unbind('click');
		jQuery(document).bind('click',{menuAll:true}, getDocumentClickEvent);
	}
	
	function showMenuAllDetails2() {
		clearTimeout(timeout);
		jQuery("#menu_all_details").show();
		jQuery(document).bind('click',{menuAll:false}, getDocumentClickEvent);
	}
	
	function  hideMenuAllDetails() {
		clearTimeout(timeout);
		jQuery("#menu_all_details").hide();
		jQuery(document).unbind('click');
	}
	
	function getDocumentClickEvent(event){
	
		var e=e?e:window.event;
        var tar = e.srcElement||e.target;
        var ids = new String(tar.id);
        //alert(event.data.fastMenu + '...' + event.data.menuAll);
        if(event.data.menuAll == false ) {
			jQuery("#menu_all_details").hide();	
			timeout = setTimeout(function(){hideMenuAllDetails();}, 10000);	
		}
		if(event.data.fastMenu == false) {
			jQuery("#menu_favorite_details").hide();	
			timeout = setTimeout(function(){hideMenuFavoriteDetails();}, 10000);	
		}
	}
	
 });
 
  
  headerTab_showFastMenu = function(left,top){
  
  		new Ajax.Request(
			'<c:url value="/modules/portlet/portletService.do?method=showFastSetting&openwin=true"/>',
				{
					method: 'post',
					parameters: '',
					onComplete: function(transport) {
						var infos = eval("("+transport.responseText+")");
						//if(infos.length > 0) {
							var tops = '<%=topHeight%>';
							jQuery("#menu_favorite_details").css({
								"top"		: tops +"px",
							    "left"		: "79.5%",
							    "opacity"	: "0.9",
								"display" 	: "block" ,
								"width" 	: "150px" ,
								//"background-color" : "#86C1DF" ,
								"position" 	: "absolute" ,
								"z-index"	: "88888" 
							});
						var menu_favorite_left = new Number(jQuery("#menu_favorite").offset().left);
						var menu_favorite_detail_width = new Number(jQuery("#menu_favorite_details").width());
						var menu_favorite_width = new Number(jQuery("#menu_favorite").width());
						var menuWidth = menu_favorite_left - menu_favorite_detail_width + menu_favorite_width;
						if(menuWidth < 0){
							menuWidth = 10;
						}
						jQuery("#menu_favorite_details").css({"left":(menuWidth)+"px"});
							if(infos.length >= 10) {
								jQuery("#menu_favorite_details").css({
								"height"	: "315px"
								});
							}
							//jQuery("#menu_favorite_details").html(data);	
							createFastMenuHtml(infos);
						//}
					},
					onFailure: function() {		
						alert("fail");		
					}
				}
		);	
  }
  
  
  	createFastMenuHtml = function(data) {
  		var str = new String();
  		str += '<div id="menu_favorite_details2" class="menu_favorite_details">';
  		str += '<table id="fastMenu" width="100%" border="0" cellspacing="0" cellpadding="0" class="menu_table" height="'+(30*data.length)+'px">';
	  	for(var i=0;i<data.length;i++) {
	  		str += '<tr id="fastMenu">';
	  		str += '<td id="fastMenu" class="menu_shortcut"/>';
	  		str += "<td id='fastMenu'><a id='fastMenu' title="+data[i].moduleName+"  class='link_top' href="+data[i].url+">" + data[i].name + "</a></td>";
	  		str += '</tr>';
	  		str += '<tr id="fastMenu">';
	  		str += '<td id="fastMenu" class="menu_favorite_shortline" colSpan="2"/>';
	  		str += '</td>';
	  		str += '</tr>';
	  	}
	  	<%if(canSetting) {%>
	  	str += '<tr height="26px">';
	  	str += '<td colSpan="2" align="right">';
	  	str += "<a class='link_top' style='text-align: right;align:right' href='../../modules/setting/user.do?method=selectMenus' >" + '${common_setting}' + "</a>";
	  	str += '</td>';
	  	str += '</tr>';
	  	<%}%>
	  	str += '</table>';
	  	str += '</div>';
	  	if(data.length >= 10) {
	  		str += '<iframe src="javascript:false"  style="position:absolute; visibility:inherit; top:0px; left:0px; width:150px; height:315px; z-index:-1; "></iframe>';
	  	}else {
	  		str += '<iframe src="javascript:false"  style="position:absolute; visibility:inherit; top:0px; left:0px; width:150px; height:'+(30*data.length)+'px; z-index:-1; "></iframe>';
	  	}
	  	jQuery("#menu_favorite_details").html(str);
	  	if(data.length >= 10) {
		  	jQuery("#menu_favorite_details2").css({
			    "opacity"	: "0.9",
				"display" 	: "block" ,
				"width" 	: "150px" ,
				"overflow-y": "auto" ,
				"height"	: "315px",
				//"background-color" : "#86C1DF" ,
				"position" 	: "absolute" ,
				"z-index"	: "88888" 
			});
		}else {
			jQuery("#menu_favorite_details2").css({
				"width" 	: "150px" ,
				"height"	: (30*data.length)+"px"
			});
		}
  	}
 	
 	
 	
</script>

<script language="javascript">
<!--

	var selSeq='${currentPage.id}';
	var subSelSeq=1;
	var cntSeq='${currentPage.id}';
	var showPageType = '${currentPage.pageType}';
	//var CntSubMenu=3;
	var operaMDown = '';
	var operaMMove = '';
	var needGoToUrl = true;
	function overMenu(s,seq,menu,pageType)
	{
		cntSeq = seq;
		if(seq==selSeq && pageType == showPageType) {
			return;
		}
		with(s.children[0].rows[0])
		{
			//cells[1].className="top_on_menu_choose_left";
			cells[1].className="top_on_menu_choose_bg";
			//cells[2].className="";
			//cells[3].className="top_on_menu_choose_right";
		}

		if(menu != null){
			//showListMenu(handle,menu);
		}
	}

	function outMenu(s,seq,menu,pageType)
	{
		
		if(seq==selSeq && pageType == showPageType) return;
		with(s.children[0].rows[0])
		{
			cells[1].className="top_Menu";
			//cells[2].className="";
			//cells[3].className="";
		}
		if(menu != null){
		//hideListMenu(menu);
		}
	}

	function overSubMenu(s,seq)
	{
		if(seq==subSelSeq) return;
		with(s.children[0].rows[0])
		{
			cells[0].className="selSubMenu_left";
			cells[1].className="selSubMenu_middle";
			cells[2].className="selSubMenu_right";			
		}
	}

	function outSubMenu(s,seq)
	{
		if(seq==subSelSeq) return;
		with(s.children[0].rows[0])
		{
			cells[0].className="";
			cells[1].className="subMenu_td";
			cells[2].className="";
		}
	}

	function showListMenu(handle,menu){
		if(!handle || !menu)return;
		if(!$(handle) || !$(menu))return;
		var menuHandleL=getAbsoluteLocationEx(document.getElementById(handle));
		if(null!=document.getElementById(menu))
		{
			document.getElementById(menu).style.pixelLeft=menuHandleL.absoluteLeft-2;
			document.getElementById(menu).style.pixelTop=menuHandleL.absoluteTop+menuHandleL.offsetHeight;
			document.getElementById(menu).style.display="";	
		}
	}

	function hideListMenu(menu){
		if(!menu || !$(menu))return;
			document.getElementById(menu).style.display="none";
	}

	function getAbsoluteLocationEx(element) {
		if (arguments.length != 1 || element == null) {
			return null;
		}
		var elmt = element;
		var offsetTop = elmt.offsetTop;
		var offsetLeft = elmt.offsetLeft;
		var offsetWidth = elmt.offsetWidth;
		var offsetHeight = elmt.offsetHeight;
		while (elmt = elmt.offsetParent) {
			if (elmt.style.position == 'absolute' || elmt.style.position == 'relative' || (elmt.style.overflow != 'visible' && elmt.style.overflow != '')) {
				break;
			}
			offsetTop += elmt.offsetTop;
			offsetLeft += elmt.offsetLeft;
		}
		return { absoluteTop: offsetTop, absoluteLeft: offsetLeft, offsetWidth: offsetWidth, offsetHeight: offsetHeight };
	}
	

	setting = function(obj) {
		
		jQuery("#headerList").sortable('enable');
		jQuery("#headerList").sortable({ 
			containment: jQuery('#header_table'),
			connectWith: ".headerList_navigation", 
	        delay: 0,
	        opacity: 0.5,
	        helper: 'clone',
	        tolerance : 'pointer',
	        axis : 'x',
	        start: function (e,ui) {
	        		needGoToUrl = false;
	        		//jQuery(obj).find(":span").unbind('mouseup');
	                jQuery(ui.helper).addClass('dragging');
	            },
	        stop: function(event,obj) {
				save();
				needGoToUrl = true;
				//goToUrl();
			} 
		}); 
	}
	
	
	
	save = function(obj) {
		
		jQuery("#headerList").sortable('disable');
		var text="";
	  	jQuery("#headerList div[name='headerList_navigation']").each(function(index) {
		    text += index + '-' + jQuery(this).attr('id') +",";
		  });
	  	text = text.substring(0, text.length-1) ;
	  	jQuery.ajax({
			url: '<c:url value="/modules/portlet/portletService.do?method=saveNavigation&openwin=true"/>',
			data:'&headerStr='+text,
			dataType:'json',
			cache:false,
			success: function(data){	
				//alert("success");		
			},
			error:function(e){
				//alert("fail");
			}
		});
	}
	
 	theMouseMove = function(obj,operation) {	
	  		setting(obj);
 	}
 	
 	goToUrl = function(url,obj) {
 	//alert(getAbsoluteLocationEx(obj).absoluteLeft);
 		if(needGoToUrl == true) {
	 		location.href=url;
 		}
 	}
  	goToUrlOpenNew = function (url,obj) {
  		if(needGoToUrl == true) {
	 		open(url);
 		}
  	}
//-->
</script>
